﻿using System.Collections.Generic;
using System.Linq;
using AutoClub.Core.Domain;
using AutoClub.Core.Domain.Dao;

namespace AutoClub.Core.Dao.Implementations
{
    /// <summary>
    /// Represents a Repository of Car Categories.
    /// </summary>
    public class CarCategoriesRepo : BaseRepo<int, CarCategory>, ICarCategoriesRepo
    {
        #region Constructor

        public CarCategoriesRepo(IUnitOfWork uof)
            : base(uof, (uof.Context as AutoClubDataContext).CarCategories, null)
        {
        }

        #endregion

        public CarCategory Get(CarCategoryEnum id)
        {
            return base.Get((int)id);
        }

        public override IEnumerable<CarCategory> GetAll()
        {
            var result = base.GetAll();

            //Saco el primer elemento que es el No Seleccionado.
            return result.OrderBy(cc => cc.Id).Skip(1);
        }
    }
}
